The following functions may be called by media packetizers during execution of an RTPMPSetSampleData or RTPMPIdle routine. Use them to tell a packet builder component to begin a packet group, to begin a packet, to insert data into a packet, to end a packet, and to end a packet group. These functions are only called by media packetizer components.
Tell a packet builder to create a new packet group. The function returns a data reference which will be used when creating new packets or inserting data into packets.
ComponentResult RTPPBBeginPacketGroup (
RTPPacketBuilder rtpb,
SInt32 inFlags,
UInt32 inTimeStamp,
RTPPacketGroupRef *outPacketGroup);
A media packetizer creates a packet group using this function. The data reference returned by this function is then used to create a series of packets that belong to this group. The data reference is also required when inserting data into packets. When the packet group is complete, call RTPPBEndPacketGroup .
Tell a packet builder to create a new packet . The function returns a data reference which will be used when creating inserting data into the packet.
ComponentResult RTPPBBeginPacket (
RTPPacketBuilder rtpb,
SInt32 inFlags,
RTPPacketGroupRef inPacketGroup,
UInt32 inPacketMediaDataLength, RTPPacketRef *outPacket);
The media packetizer uses this function to create each new packet, prior to inserting any literal, repeated, and/or sample data. A call to RTPPBBeginPacketGroup must be made prior to creating the first packet in a group. Data is inserted into the packet using RTPPBAddPacketLiteralData , RTPPBAddPacketRepeatedData , and/or RTPPBAddPacketSampleData . When the packet is complete, call RTPPBEndPacket .
Pass literal data directly to a packet builder component. For example, use this function to insert static header information into a packet prior to inserting media sample data. This function will return a data reference you can use to insert the same static information into later packets.
ComponentResult RTPPBAddPacketLiteralData (
RTPPacketBuilder rtpb,
SInt32 inFlags,
RTPPacketGroupRef inPacketGroup,
RTPPacketRef inPacket,
UInt8 *inData,
UInt32 inDataLength,
RTPPacketRepeatedDataRef *outDataRef);
This function will return a reference which can be used to specify the same data repeatedly without having to pass in the data again. This is done by calling RTPPBAddPacketRepeatedData with the reference which was returned by RTPPBAddPacketLiteralData . When a reference is no longer needed, it should be disposed of by using the call RTPPBReleaseRepeatedData . To specify media data to be placed in a packet, a media packetizer should call RTPPBAddPacketSampleData .
A media packetizer uses this function to command a packet builder component to insert media sample data into a packet. This typically follows static header information inserted by calling either RTPPBAddPacketLiteralData or RTPPBAddPacketRepeatedData . The media packetizer specifies the offset into the media and the length of the sample to insert.
ComponentResult RTPPBAddPacketSampleData (
RTPPacketBuilder rtpb,
SInt32 inFlags,
RTPPacketGroupRef inPacketGroup,
RTPPacketRef inPacket,
RTPMPSampleDataParams *inSampleDataParams,
UInt32 inSampleOffset,
UInt32 inSampleDataLength,
RTPPacketRepeatedDataRef *outDataRef);
This function will return a reference which can be used to specify the same data repeatedly without having to pass in the data again. This is done by calling RTPPBAddPacketRepeatedData with the reference which was returned by RTPPBAddPacketLiteralData . When a reference is no longer needed, it should be disposed of by using the call RTPPBReleaseRepeatedData . To specify media data to be placed in a packet, a media packetizer should call RTPPBAddPacketSampleData .
Tell a packet builder component to insert previously-specified data into a packet. This is typically done to repeat static header information into a series of packets, or to insert previously-sent sample data into a redundant packet. The data is first specified by a call to RTPPBAddPacketLiteralData or RTPPBAddPacketSampleData , which inserts the data the first time and returns a data reference. Use the data reference with RTPPBAddPacketRepeatedData to send the data again.
ComponentResult RTPPBAddPacketRepeatedData (
RTPPacketBuilder rtpb,
SInt32 inFlags,
RTPPacketGroupRef inPacketGroup,
RTPPacketRef inPacket,
RTPPacketRepeatedDataRef inDataRef);
Allow a packet builder to deallocate data that will no longer be used.
ComponentResult RTPPBReleaseRepeatedData (
RTPPacketBuilder rtpb,
RTPPacketRepeatedDataRef inDataRef);
When a media packetizer passes data to a packet builder using RTPPBAddPacketLiteralData or RTPPBAddPacketSampleData , the packet builder can return a data reference. The media packetizer can use this data reference to insert the same data into other packets. The media packetizer must release this data when it is no longer needed.
You must release the data if you have allowed RTPPBAddPacketLiteralData or RTPPBAddPacketSampleData to return a data reference, even if you have not called RTPPBAddPacketRepeatedData .You must either pass in a nil to the data reference when adding literal or sample data, or you must release the data by calling this function.
A media packetizer calls this function to tell a packet builder that a packet is complete.
ComponentResult RTPPBEndPacket (
RTPPacketBuilder rtpb,
SInt32 inFlags,
RTPPacketGroupRef inPacketGroup,
RTPPacketRef inPacket,
UInt32 inTimeOffset,
UInt32 inDuration);
Tell a packet builder component that a packet group is complete.
ComponentResult RTPPBEndPacketGroup (
RTPPacketBuilder rtpb,
SInt32 inFlags,
RTPPacketGroupRef inPacketGroup);
| Previous | Chapter Contents | Chapter Top | Next |